<%@ taglib prefix="page" uri="http://com.qipay/pagelib" %>
<%@ page language="java" import="com.qipay.admin.order.vo.OrderVo" contentType="text/html;charset=utf-8" %>
<%@ page import="com.qipay.admin.utils.SiteHelper" %>
<%@ page import="org.apache.commons.collections.CollectionUtils" %>
<%@ page import="org.apache.commons.lang3.StringUtils" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Map" %>
<!doctype html>
<html>
<head>
    <jsp:include page="head.jsp"></jsp:include>
    <link rel="stylesheet" href="<%= request.getAttribute("StaticHost") %>/css/dataTables.bootstrap.min.css">
    <link rel="stylesheet" href="<%= request.getAttribute("StaticHost") %>/css/bootstrap-datepicker3.min.css">

</head>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
    <jsp:include page="nav.jsp"></jsp:include>
    <jsp:include page="left.jsp"></jsp:include>
    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Main content -->
        <section class="content">
            <div class="row">
                <div class="col-xs-12">
                    <div class="box">
                        <%--Title--%>
                        <div class="box-header">
                            <h3 class="box-title">订单统计</h3>
                        </div>
                        <!-- /.box-header -->
                        <div class="box-body">
                            <%
                                Integer count = (Integer) request.getAttribute("count");
                                Double amount = (Double) request.getAttribute("amount");
                                Double fee = (Double) request.getAttribute("fee");
                                String from = (String) request.getAttribute("from");
                                String to = (String) request.getAttribute("to");
                                Integer channel = (Integer) request.getAttribute("channel");
                            %>

                            <div class="box-body" id="dvContent">
                                <div class="box-body">
                                    <form class="form-inline" action="/statement/order">
                                        <div class="form-group date form_datetime">
                                            <label for="from">开始日期：</label>
                                            <input type="text" class="form-control" id="from" name="from" readonly
                                                   value="<%= StringUtils.isNotBlank(from) ?from:""%>">
                                        </div>
                                        <div class="form-group date form_datetime">
                                            <label for="to">结束日期：</label>
                                            <input type="text" class="form-control" id="to" name="to" readonly
                                                   value="<%= StringUtils.isNotBlank(to) ?to:""%>">
                                        </div>
                                        <div class="form-group">
                                            <label for="channel">支付方式：</label>
                                            <select class="form-control" id="channel" name="channel">
                                                <%
                                                    Map<Integer, String> channelMap = (Map<Integer, String>) request.getAttribute("channels");
                                                    for (Integer key : channelMap.keySet()) {
                                                        String value = channelMap.get(key);
                                                %>
                                                <option value="<%=key%>"
                                                        <% if (null != channel && channel.equals(key)) {%>
                                                        selected="selected"<%}%>>
                                                    <%=value%>
                                                </option>
                                                <%}%>
                                            </select>
                                        </div>
                                        <button type=" submit" class="button back-gray" id="btnSearch">查询</button>
                                    </form>
                                </div>
                                </br>
                                <table id="pLst" class="table table-bped table-hover">
                                    <thead>
                                    <tr>
                                        <th>日期</th>
                                        <th>支付方式</th>
                                        <th>总笔数 （<span style="color: green"><%=count%></span>）</th>
                                        <th>总金额 （<span
                                                style="color: green"><%=SiteHelper.formatMoney(amount)%></span>）
                                        </th>
                                        <th>费率</th>
                                        <th>手续费 （<span
                                                style="color: green"><%=SiteHelper.formatMoney(fee)%></span>）
                                        </th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <%
                                        List<List<String>> list = (List<List<String>>) request.getAttribute("lst");
                                        if (CollectionUtils.isNotEmpty(list)) {
                                            for (List<String> p : list) {
                                    %>
                                    <tr>
                                        <td>
                                            <%=p.get(0)%>
                                        </td>
                                        <td>
                                            <%=p.get(1)%>
                                        </td>
                                        <td>
                                            <%=p.get(2)%>
                                        </td>
                                        <td>
                                            <%=p.get(3)%>
                                        </td>
                                        <td>
                                            <%=p.get(4)%>
                                        </td>
                                        <td>
                                            <%=p.get(5)%>
                                        </td>
                                        <%
                                            }
                                        %>
                                    </tr>
                                    <%
                                    } else {
                                    %>
                                    <tr>
                                        <td colspan="6">未找到数据</td>
                                    </tr>
                                    <% }%>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </div>

    <jsp:include page="foot.jsp"></jsp:include>
</div>
<script src="<%= request.getAttribute("StaticHost") %>/js/jquery.dataTables.min.js"></script>
<script src="<%= request.getAttribute("StaticHost") %>/js/bootstrap-datepicker.min.js"></script>
<script src="<%= request.getAttribute("StaticHost") %>/js/bootstrap-datepicker.zh-CN.min.js"></script>
<script src="<%= request.getAttribute("StaticHost") %>/js/adminlte.min.js"></script>

<script>
    $(function () {
        $('#from, #to').datepicker({
            format: "yyyy-mm-dd",
            todayBtn: true,
            clearBtn: true,
            language: "zh-CN"
        });
    });
</script>
</body>
</html>

